package com.kanche.bigbaby.collection.domain;

import com.kanche.bigbaby.collection.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by nealmi on 6/12/14.
 */
public class VehicleModel implements Serializable {
    public static final int HOT_ID = -100;
    public static final int UNLIMITED_ID = -200;
    private static final String[] hotBrands = new String[]{
            "大众",
            "丰田",
            "本田",
            "奥迪",
            "现代",
            "宝马",
            "日产",
            "别克",
            "马自达",
            "雪佛兰",
            "奔驰",
            "福特",
            "铃木",
            "比亚迪",
            "奇瑞",
            "长安",
            "雪铁龙",
            "起亚",
            "长城",
            "三菱",
            "五菱",
            "江淮",
            "夏利",
            "东风",
            "吉利",
            "标致",
            "Jeep",
            "路虎",
            "福田",
            "中华"
    };
    private static List<VehicleModel> hots;
    private int id;
    private String label;
    private String levelId;
    private String maker = "";
    private String brand = "";
    private String series = "";
    private String saleName = "";
    private String yearGroup = "";
    private String makeYear = "";
    private String createAt;

    public VehicleModel() {
    }

    public VehicleModel(String brand) {
        this.brand = brand;
    }


    public VehicleModel(String brand, String series) {
        this.brand = brand;
        this.series = series;
    }

    public static List<VehicleModel> getHotBrands() {
        if (hots == null) {
            hots = new ArrayList<VehicleModel>();
            for (String brand : hotBrands) {
                VehicleModel model = new VehicleModel();
                model.setId(HOT_ID);
                model.setBrand(brand);
                hots.add(model);
            }
        }
        return hots;
    }

    public String getLevelId() {
        return levelId;
    }

    public void setLevelId(String levelId) {
        this.levelId = levelId;
    }

    public String getMaker() {
        return maker;
    }

    public void setMaker(String maker) {
        this.maker = maker;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getSeries() {
        return series;
    }

    public void setSeries(String series) {
        this.series = series;
    }

    public String getSaleName() {
        return saleName;
    }

    public void setSaleName(String saleName) {
        this.saleName = saleName;
    }

    public String getYearGroup() {
        return yearGroup;
    }

    public void setYearGroup(String yearGroup) {
        this.yearGroup = yearGroup;
    }

    public String getMakeYear() {
        return makeYear;
    }

    public void setMakeYear(String makeYear) {
        this.makeYear = makeYear;
    }

    public String getCreateAt() {
        return createAt;
    }

    public void setCreateAt(String createAt) {
        this.createAt = createAt;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getFullName() {
        return brand + "-" + series + "-" + saleName;
    }

    public String getDesc() {
        String desc = "";
        if (StringUtils.hasText(brand)) {
            desc += brand;
        }
        if (StringUtils.hasText(series)) {
            desc += "-" + series;
        }
        if (StringUtils.hasText(saleName)) {
            desc += "-" + saleName;
        }
        return desc;
    }

    public void cleanUnlimitedLabels() {
        if ("不限".equals(brand)) {
            brand = "";
        }
        if ("不限".equals(series)) {
            series = "";
        }
        if ("不限".equals(saleName)) {
            saleName = "";
        }
    }
}
